home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / batchut / batsec.zip / CHAPT5 < prev    next >
Text File  |  1992-03-03  |  9KB  |  259 lines

  1.  
  2.  
  3.                             CHAPTER 5
  4.                                
  5.                       KEYBOARD MACROS
  6.              Using the F Function Keys (F1 to F10)
  7.  
  8.         ▀  Keyboard Macros
  9.         ▀  Redefining Keys
  10.         ▀  Writing Scan Codes
  11.         ▀  One Keystroke Commands
  12.  
  13.  
  14.  
  15.         MACROS ARE DESIGNED TO SAVE KEYSTROKES.
  16.         You can put one or several strings of command
  17.         together and assign them as one group to one of
  18.         the keys. When that key is struck it will carry
  19.         out (execute) all the commands you assigned to that key.
  20.  
  21.         The F function keys (F1 to F10) are the keys most used
  22.         for storing the Macros (Commands). The ten F function keys
  23.         are also used in  combination with the Shift key, Control key,
  24.         and the Alt key. This gives 40 possible Macros that you can
  25.         make.
  26.  
  27.         The F keys (F1 to F10) when used by themselves  make
  28.         a single keystroke Macro. This means that if you assign the F1
  29.         key the command to Format a disk, then when you strike the
  30.         F1 key it will Format a disk. It does not require that you press
  31.         the Enter key. Most Macros include the automatic carriage
  32.         return which is the same as pressing the Enter key.
  33.  
  34.         When you combine an F key with the Shift key  you make a
  35.         two-keystroke Macro. To use a Shift-F key Macro you press
  36.         and hold down the Shift key and then strike the F key.
  37.  
  38.         REDEFINING KEYS
  39.         Redefining keys means changing the content of the key
  40.         to represent something different from the function assigned
  41.         to that key: For example, you can change the F1 function key
  42.         (top row) to mean Copy, Format, or anything you like. The
  43.         name of the key will still be F1, but you have changed the
  44.         contents of F1 so that when you strike the F1 key it may Copy
  45.         a file, Format a disk, or something else.
  46.  
  47.         Redefining keys is a good way  of putting commands in
  48.         keys that you don't use and make them a super Speed key that
  49.         uses only one keystroke. Most Macros use the F keys first, then
  50.         a combination then the Alt-F keys and Shift-F keys.
  51.  
  52.         Since these F keys will be used only for a particular
  53.         command you can make the key have an Automatic Return.
  54.         This means that when you strike a particular F key it will
  55.         automatically trigger the return key.  All you need to do is
  56.         strike one key and the command goes into action.  This type
  57.         of key is called a single keystroke Macro. The F-key
  58.         combinations (SHIFT-F1) are two keystroke Macros.
  59.  
  60.  
  61.  
  62.                              -16-
  63.  
  64.  
  65.  
  66.  
  67.  
  68.         Macros are easily cancelled and can be redefined and
  69.         made into another Macro. There are temporary Macros that
  70.         you can create as you need them, and there are the permanent
  71.         Macros that are stored on your disk.
  72.  
  73.  
  74.         MACROS ARE FAST AND DO THE JOB
  75.         Macros save keystrokes.
  76.         Macros are used in almost all word processing programs,
  77.         spreadsheets, database, and most other programs.
  78.  
  79.         A NOTE ABOUT F KEYS
  80.         If you use the F6 key as a Macro you can make an  F6 by
  81.         using Ctrl + Z keys. This is the same as striking the F6 key.
  82.         This is important when writing Batch files  where the F6 key
  83.         is used to end a line of text.
  84.  
  85.         EVERY KEY ON THE KEYBOARD HAS A CODE NUMBER
  86.         By using the number (called a Scan Code) corresponding
  87.         to the key you can change the content (assignment) of that
  88.         key. The keyboard Scan Code for the F1 key is 0;59, F2 is 0;60,
  89.         F3 is 0;61 and so forth to F10 which is 0;68.
  90.         Table 1 is a list of redefinition code numbers (scan codes)
  91.         to be used in redefining the F keys and combinations of F keys.
  92.  
  93.  
  94.                      TABLE OF KEY CODES
  95.                                                                 
  96.    F-Key Code   SHIFT-F  CODE   CTRL-F   CODE     ALT-F  CODE
  97.  
  98.    F1    0;59   SH-F1   0;84   Ctrl-F1  0;94   Alt-F1   0;104
  99.    F2    0;60   SH-F2   0;85   Ctrl-F2  0;95   Alt-F2   0;105
  100.    F3    0;61   SH-F3   0;86   Ctrl-F3  0;96   Alt-F3   0;106
  101.    F4    0;62   SH-F4   0;87   Ctrl-F4  0;97   Alt-F4   0;107
  102.    F5    0;63   SH-F5   0;88   Ctrl-F5  0;98   Alt-F5   0;108
  103.  
  104.    F6    0;64   SH-F6   0;89   Ctrl-F6  0;99   Alt-F6   0;109
  105.    F7    0;65   SH-F7   0;90   Ctrl-F7  0;100  Alt-F7   0;110
  106.    F8    0;66   SH-F8   0;91   Ctrl-F8  0;101  Alt-F8   0;111
  107.    F9    0;67   SH-F9   0;92   Ctrl-F9  0;102  Alt-F9   0;112
  108.    F10   0;68   SH-F10  0;93   Ctrl-F10 0;103  Alt-F10  0;113
  109.                                                      
  110.    F11  0;133   Home Key 0;71  Down Arrow 0;80
  111.    F12  0;134   Up Arrow 0;7
  112.  
  113.  
  114.         WRITING SCAN CODES
  115.         All code numbers are always separated by a semicolon.
  116.         All codes must have this Prompt Escape sign:
  117.         Prompt $e[   .....
  118.         There are four items to remember in using the Escape
  119.         sign, they are:
  120.         ▀ Prompt $e[
  121.         ▀ semicolon (;)
  122.         ▀ The small "p"   (tells DOS that it is end of file)
  123.         ▀ The number 13 is the code for carriage return
  124.         (Same as pressing the Enter key.)
  125.  
  126.                              -17-
  127.  
  128.  
  129.  
  130.  
  131.  
  132.         Remember these four items and you'll have no problems with
  133.         Macros or Key definition (Changes).
  134.  
  135.         HERE'S AN EXAMPLE
  136.         Prompt $e[  0;59; "DIR";  13 p $p$g
  137.                                                                  
  138.         Putting them together it looks like this:
  139.                                          
  140.         Prompt $e[0;59;"DIR";13p  $p$g
  141.                                      
  142.         The quotation marks tell the computer that the item in quotes
  143.             is not an ASCII character.
  144.         ▀ The $p$g gives you a prompt A:\>, and saves you
  145.             from having to type the word prompt.
  146.         ▀ The small "p" tells the computer that it is the end of
  147.             the string of numbers and letters.
  148.         ▀ The small "p" must always be the last item when you
  149.             are using key functions.
  150.         ▀ The character 13 is the code for carriage return
  151.             (same as pressing the Enter key).
  152.                   
  153.         HOW TO USE THE CODE NUMBERS
  154.         Suppose you want to make the F1 key into the Directory
  155.         so that each time you press the F1 key the directory of the disk
  156.         in drive A would appear on the screen. You make the change
  157.         like this:
  158.                                                                  
  159.                 Prompt $e[0;59;"DIR";13p  $p$g
  160.                     <Press the Enter Key.>
  161.                                                        
  162.         When you press the F1 key the computer automatically
  163.         "presses" the Enter key for you and the contents of the
  164.         directory appears on the screen. The F1 key will remain active
  165.         until you either cancel it or turn off the computer.
  166.         To make the F1 Macro permanent you must put it in the
  167.         Autoexec.Bat File.
  168.  
  169.         AUTOEXC.BAT FILES AND LOADING THE F FUNCTION KEYS WITH
  170.         MACROS IS PRESENTED IN DISK #2.
  171.  
  172.         HOW TO CANCEL AN F KEY
  173.         The rule in cancelling any key that has been
  174.         redefined (changed) is to repeat the same scan code like
  175.         this:
  176.                                                                  
  177.                 Prompt $e[0;59;0;59p  $p$g
  178.                  <Press the Enter Key.>
  179.         The key is back to its normal F1 function.
  180.  
  181.  
  182.         WRITING A BAT FILE FOR THE DATE AND TIME
  183.         Type the following next to the A:\> prompt, like this:
  184.    
  185.                 Copy Con DT.Bat
  186.                 Prompt $e[1;32;45m $d $t $g
  187.                 Press F6 Key, then press Enter key.
  188. ------------
  189.  
  190.  
  191.  
  192.                              -18-
  193.  
  194.  
  195.  
  196.  
  197.  
  198.         PUTTING THE DT BAT FILE INTO A MACRO  (See disk #2 below)
  199.         The Date-Time Bat file will be stored in
  200.         the Up arrow key. The scan code for the Up arrow is
  201.         0;72.
  202.